package day0717;

import java.util.Random;
import java.util.Scanner;

public class Test4 {
    public static void main(String[] args) {
        Random r=new Random();
        int  rightNumber=r.nextInt(50);//r.nextInt()产生一个随机数

        Scanner s=new Scanner(System.in);
        //用Scanner输入另一个数字，作为答案
        System.out.println("请输入答案");
        int intputAnswer=s.nextInt();

        //  ==  !=  :   byte short int long  char  boolean double float
        //  .equals()  :基本类型之外
        while(rightNumber != intputAnswer){//如果rightNumber不等于intputAnswer，就继续输入
            if(rightNumber<intputAnswer){
                System.out.println("猜大了");
            }else{
                System.out.println("猜小了");
            }
            intputAnswer=s.nextInt();
        }
        //输出猜对了
        System.out.println("恭喜你猜对了");
    }
}
